<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 相当于实例一个组件 common-head 相当于 new app.component产生的组件class -->
      <common-head></common-head>
    
      
    </div>

    <script src="./vue.global.js"></script>
    <script>
      const { createApp } = Vue;
      const app = createApp();
      const CommonNav = {
        template: `
          <div>
            <h2>这是子组件</h2>  
          </div>
        `
      }
      const CommonHead = {
        // 视图模板属性
        template: `
        <div>
          <h1>这是父组件</h1>  
          <common-nav></common-nav>
        </div>
      `,
        data() {
          return {
            msg: "这是头部组件的数据",
          };
        },
        components: {
          CommonNav
        }
      };
      app.component("CommonHead", CommonHead);
      app.mount("#app");
    </script>
  </body>
</html>
